
export default {

  grid: {//设置图表四周留白间距
    top: '15%',
    right: '5%',
    bottom: '10%',
    left: '10%'
  },
  tooltip: {
    trigger: 'axis',
    formatter: function (params) {
      let temp = `<div>${params
        .map((item) => {
          //if (item.value > 40)
          return `
            <div style="display: flex;justify-content: flex-start;align-items: center;margin-top: 6px">
              <div style="width: 8px;height:8px;border-radius:50%;background-color:${item.color};"></div>
              <div style="margin-left: 10px">
               
                ${item.seriesName}：${item.value || "--"}
                
                ${item.value > 40 && item.data?.station ? `<br/>电站：${item.data.station}` : ''} 
              </div>
            </div>
          `;
        })
        .join("")}</div>`;
      return `
        <div>
          <div>${params[0].name}</div>
          ${temp}
        </div>
      `;
    },

  },
  legend: {
    textStyle: {
      color: '#fff'
    },
    top: 0,
  },
  xAxis: {
    type: 'category',
    boundaryGap: false,
    data: [],
    axisLabel: {
      fontSize: 10,
      formatter: (value) =>  //X轴的内容
      {

        let ret = ""; //拼接加\n返回的类目项
        let max = 10;  //每行显示的文字字数
        let val = value.length;  //X轴内容的文字字数
        let rowN = Math.ceil(val / max);  //需要换的行数
        if (rowN > 1)  //判断 如果字数大于2就换行
        {
          for (let i = 0; i < rowN; i++) {
            let temp = "";  //每次截取的字符串
            let start = i * max;  //开始截取的位置
            let end = start + max;  //结束截取的位置
            temp = value.substring(start, end) + "\n";
            ret += temp;  //最终的字符串
          }
          return ret;
        }
        else { return value }
      },

    },

  },
  yAxis: {
    min: 25,
    axisLabel: {
      fontSize: 10
    },
    splitLine: {
      lineStyle: {
        color: "rgba(255,255,255,0.05)"
      }
    },
    type: 'value'
  },
  series: [{
    data: [],
    type: 'line',
    symbol: 'circle',
    smooth: true,
    color: '#49f1f4', //改变折线点的颜色
    lineStyle: {
      color: '#49f1f4', //改变折线颜色
      width: 3,
    },

  }, {
    data: [],
    type: 'line',
    symbol: 'circle',
    smooth: true,
    itemStyle: {
      normal: {
        color: '#45da6e', //改变折线点的颜色
        lineStyle: {
          color: '#45da6e', //改变折线颜色
          width: 3,
        }
      }
    }
  }]

}